#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
fun(int n)
{
	while (n > 9)
	{
		fun(n / 10);
		n = n % 10;
	}
	printf("%d", n );
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	fun(n);
	return 0;
}